const express = require('express');
const app = express();
let apiRoutes = express.Router();

let appData = require('./public/data');
let seller = appData.seller;
// let goods = appData.goods;
// let ratings = appData.ratings;
app.use('/api', apiRoutes);

module.exports = {
    publicPath: '/client',
    pages: {
        client: {
            entry: 'src/page/client/main.js',
            template: 'public/index.html',
            filename: 'client'
        },
        server: {
            entry: 'src/page/server/main.js',
            template: 'public/index.html',
            filename: 'server'
        }
    },
    devServer: {
        port: 9000,
        disableHostCheck: true,
        proxy: "http://localhost:9001",
        // before(app) {
            // app.get('/api/goods', (req, res) => {
            //     res.json({
            //         errno: 0,
            //         data: goods
            //     })
            // });
            // app.get('/api/ratings', (req, res) => {
            //     res.json({
            //         errno: 0,
            //         data: ratings
            //     })
            // });
            // app.get('/api/seller', (req, res) => {
            //     res.json({
            //         errno: 0,
            //         data: seller
            //     })
            // })
        // }
    }
};
